﻿package  
{
	import flash.display.DisplayObject;
	import flash.display.Shape;
	import fl.transitions.Tween;
	import fl.transitions.easing.*;
	import flash.display.Sprite;
	import flash.events.Event;
	/**
	 * ...
	 * @author chancidal
	 */
	public class Ball extends Sprite
	{
		//
		private var circle:Shape;
		private var twnX:Tween;
		private var twnY:Tween;
		private var twnAlpha:Tween;
		//
		public function Ball() 
		{
			circle = new Shape();
			addChild(circle);
			circle.graphics.beginFill(0x0099FF, .1);
			circle.graphics.drawCircle(0, 0, 17);
			circle.addEventListener(Event.ENTER_FRAME, deleteCircle);
			twnX = new Tween(circle, "scaleX", Regular.easeIn, 1, 0, .5, true);
			twnY = new Tween(circle, "scaleY", Regular.easeIn, 1, 0, .5, true);
			twnAlpha = new Tween(circle, "alpha", Regular.easeIn, 1, 0, .5, true);
		}
		private function deleteCircle(evt:Event):void {
			if (evt.target.alpha == 0) {
				evt.target.removeEventListener(Event.ENTER_FRAME, deleteCircle);
				evt.target.parent.removeChild(evt.target);
			}
		}
	}

}